package com.edu.handler;

import com.edu.filter.AuthInterceptor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ProjectName: myApp
 * @Titile: AuthInterceptorConfig
 * @Author: Administrator
 * @Description: 注册拦截器
 */
@SpringBootConfiguration
public class AuthInterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器
        registry.addInterceptor(new AuthInterceptor())
                .addPathPatterns("/**")//拦截所有
                .excludePathPatterns("/api/user/login","/api/user/register","/api/product/**");//放行，不拦截

    }
}
